<template>
    <div class="qingwu">
        <div class="admin_table_page_title">
            <a-button @click="$router.back()" class="float_right" icon="arrow-left">返回</a-button>
            公司及联系人信息
        </div>
        <div class="unline underm"></div>
        <div class="admin_form">
            <a-form-model :label-col="{ span: 6 }" :wrapper-col="{ span: 12 }" >
                <a-form-model-item label="企业名称">
                    <a-input v-model="info.company_name" ></a-input>
                </a-form-model-item>

                <a-form-model-item label="统一社会信用代码">
                    <a-input v-model="info.unified_social_credit_code"></a-input>
                </a-form-model-item>

                <a-form-model-item label="法人代表">
                    <a-input v-model="info.legal_person"></a-input>
                </a-form-model-item>

                <a-form-model-item label="企业详细地址">
                    <a-input v-model="info.address"></a-input>
                </a-form-model-item>

                <a-form-model-item label="注册资本">
                    <a-input v-model="info.registered_capital"></a-input>
                </a-form-model-item>

                <a-form-model-item label="成立日期">
                    <a-input v-model="info.date_of_establishment"></a-input>
                </a-form-model-item>

                <a-form-model-item label="联系人">
                    <a-input v-model="info.contact_person"></a-input>
                </a-form-model-item>

                <a-form-model-item label="联系电话">
                    <a-input v-model="info.contact_person_mobile"></a-input>
                </a-form-model-item>

                <a-form-model-item label="电子邮箱">
                    <a-input v-model="info.email"></a-input>
                </a-form-model-item>
            </a-form-model>

            <div class="admin_table_page_title">
                营业执照信息
            </div>
            <div class="unline underm"></div>

            <a-form-model :label-col="{ span: 6 }" :wrapper-col="{ span: 12 }" >
                <a-form-model-item label="营业执照号">
                    <a-input v-model="info.business_license_no" ></a-input>
                </a-form-model-item>

                <a-form-model-item label="营业执照有效期">
                    <a-input v-model="info.validity_period_business_license"></a-input>
                </a-form-model-item>

                <a-form-model-item label="营业执照电子版">
                    <a-card >
                        <img alt="example" :src="info.electronic_version_business_license" />
                    </a-card>
                </a-form-model-item>

                <a-form-model-item label="一般纳税人证明">
                    <a-card >
                        <img alt="example" :src="info.tax_certificate"  />
                    </a-card>
                </a-form-model-item>
            </a-form-model>

            <div class="unline underm"></div>

            <a-modal
                title="驳回"
                :visible="visible"
                :confirm-loading="confirmLoading"
                @ok="handleOk"
                @cancel="handleCancel"
            >
                <a-form-model-item label="驳回原因" >
                    <a-input v-model="reason_rejection" type="textarea" />
                </a-form-model-item>
            </a-modal>


            <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" v-if="info.check == 0">
                <a-button type="primary" @click="handleSubmit">通过</a-button>
                <b style="margin-right: 30px">&nbsp;</b>
                <a-button type="danger" @click="showModal">驳回</a-button>
            </a-form-model-item>

            <a-form-model :label-col="{ span: 6 }" :wrapper-col="{ span: 12 }" >
                <a-form-model-item label="驳回原因" v-if="info.check == 2">
                    <a-input v-model="info.reason_rejection"></a-input>
                </a-form-model-item>
            </a-form-model>
        </div>
    </div>
</template>

<script>
export default {
    components: {},
    props: {},
    data() {
        return {
            info:{
            },
            id:0,
            options: [],
            areas:[],
            ModalText: 'Content of the modal',
            visible: false,
            confirmLoading: false,
            reason_rejection:''
        };
    },
    watch: {},
    computed: {},
    methods: {
        showModal() {
            this.visible = true;
        },
        handleSubmit(){
            this.$confirm({
                title: '你确定要通过该物业的审核?',
                content: '审核成功后可在物业列表修改物业状态',
                okText: '是',
                okType: 'danger',
                cancelText: '取消',
                onOk:()=> {
                    this.$post(this.$api.editPropertyCheck,{id:this.id , property_id:this.info.id}).then(res=>{
                        if(res.code == 200){
                            this.$message.success(res.msg)
                            return this.$router.back();
                        }else{
                            return this.$message.error(res.msg)
                        }
                    })
                },
            });
        },
        get_info(){
            this.$get(this.$api.adminProperty +'/'+this.id).then(res=>{
                this.info = res.data;
            })
        },
        handleOk(e) {
            this.confirmLoading = true;

            this.$post(this.$api.editPropertyCheck,{id:this.id , property_id:this.info.id , check:'false' , reason_rejection : this.reason_rejection}).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.msg)
                    return this.$router.back();
                }else{
                    return this.$message.error(res.msg)
                }
            })

            this.confirmLoading = false;
        },
        handleCancel(e) {
            this.visible = false;
        },
    },
    created() {
        this.id = this.$route.params.id;
        this.get_info();
    },
    mounted() {}
};
</script>
<style lang="scss" scoped>

</style>
